<template>
  <el-container style="height: 100%; border: 1px solid #eee">
    <el-aside :width="aside_width" style="height: 100vh ;background-color: rgb(168, 168, 168,0.3);margin-left: -1px">
        <Aside :isCollapse="isCollapse"></Aside>
    </el-aside>

    <el-container style="height: 100%;">
      <el-header style="text-align: right; font-size: 12px;border-bottom: darkgray 1px solid">
        <Header @doCollapse="doCollapse" :icon="icon"></Header>
      </el-header>

      <el-main style="height: 100%;">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>

</template>

<script>
import Aside from "@/components/Aside";
import Header from "@/components/Header";

export default {
    name: "Index",
  components: {Header, Aside},
  data(){
    return {
      isCollapse:false,
      aside_width:'200px',
      icon:'el-icon-s-fold',
    }
  },
  methods:{
      //菜单栏收缩
      doCollapse(){
        this.isCollapse=!this.isCollapse
        if(!this.isCollapse){
          //此时菜单栏展开
          this.aside_width='200px'
          //图标变化
          this.icon='el-icon-s-fold'
        }else{
          //此时菜单栏关闭
          this.aside_width='65px'
          //图标变化
          this.icon='el-icon-s-unfold'
        }
      },
  },
}
</script>

<style scoped>
.el-header {
  #background-color: #B3C0D1;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
.el-main{
  padding: 5px;
}
</style>